package cb.tools;

import static org.jhotdraw.draw.AttributeKeys.DECORATOR_INSETS;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.net.URL;

import org.jhotdraw.draw.EllipseFigure;
import org.jhotdraw.draw.Figure;
import org.jhotdraw.draw.RectangleFigure;
import org.jhotdraw.draw.RotateHandle;
import org.jhotdraw.draw.TextFigure;
import org.jhotdraw.geom.Insets2DDouble;
import org.jhotdraw.util.ResourceBundleUtil;

import cb.images.Stream;

public class CurrentSource extends EllipseFigure
	{
		
	
		public CurrentSource()
			{
				super();
//				TextFigure rf = new TextFigure();
//				setDecorator(rf);
//				// createConnectors();
//				setDrawDecoratorFirst(true);
//				
//				ResourceBundleUtil labels = ResourceBundleUtil
//						.getLAFBundle("cb.properties.Labels");
//				rf.setText(labels.getString("CurrentSourceDefaultName"));
				
			}
		@Override
		 public void basicSetBounds(Point2D.Double anchor, Point2D.Double lead) {
		        ellipse.x = Math.min(anchor.x, lead.x);
		        ellipse.y = Math.min(anchor.y , lead.y);
		        ellipse.width = 40;
		        ellipse.height = 40;
		    }
		@Override
		protected void drawFill(Graphics2D g)
			{
				Image img;
				URL myurl = Stream.class.getResource("current.gif");
				Toolkit tk = Toolkit.getDefaultToolkit();
				img = tk.getImage(myurl);
				g.drawImage(img, (int) ellipse.x + 5, (int) ellipse.y + 7, 30,
						30, null);
				AffineTransform transform = new AffineTransform();
		       transform.rotate(Math.PI / 2);

			}
	}
